home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 352_01 / lc.cpp < prev    next >
C/C++ Source or Header  |  1991-04-22  |  818b  |  38 lines

  1. //    LC.CPP -
  2. //        this module contains the basic routines for class LinkClass.
  3. // 
  4. #include <stdlib.h>
  5. #include <alloc.h>
  6. #include <iostream.h>
  7. #include "wtwg.h"
  8.  
  9. #include "dblib.h"
  10.         
  11. void LinkClass::initBase ()
  12.                   {
  13.                   if ( nx == NULL )
  14.                     {
  15.                     // make sure a previously empty node pts to itself.
  16.                     // ensures that static nodes are correctly initialized
  17.                     // ...when the first element in the list is added.
  18.                     nx = pv = this;
  19.                     }
  20.                   };
  21.  
  22.  
  23. LinkClass::LinkClass(LinkClass& base, void *data)
  24.             { 
  25.             base.initBase();
  26.             dt=data; 
  27.             this->insertBelow(base);  // chain grows so oldest = base.first() 
  28.             }; 
  29.     
  30.     
  31. void LinkClass::unLink () 
  32.     {
  33.     pv->nx = nx;
  34.     nx->pv = pv;
  35.     };                // end LinkClass::unLink()
  36.     
  37. //----------------- end of LC.CPP --------------------
  38.